package cn.itcast.utils;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;


public class FileNameUtils {


    public static String getName(String fileName) {

        //   SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");

        //  String time = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());

//        int i = fileName.lastIndexOf(".");
//
//        String name = fileName.substring(fileName.lastIndexOf("."));


        return new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + fileName.substring(fileName.lastIndexOf("."));
    }



    public static void main(String[] args) throws Exception {



    }



    public List<String[]> method1(MultipartFile file) throws IOException {


        XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());

        XSSFSheet sheetAt = workbook.getSheetAt(0);

        for(Row row : sheetAt) {

            for(Cell cell : row) {


            }
        }

        return null;
    }

}
